<?php

/**
 * This is the model class for table "emetteur".
 *
 * The followings are the available columns in table 'emetteur':
 * @property integer $ID_EMETTEUR
 * @property string $NOM_EMETTEUR
 * @property string $PRENOM_EMETTEUR
 * @property string $MAIL_EMETTEUR
 * @property string $LOGIN_EMETTEUR
 * @property string $PASSWORD_EMETTEUR
 *
 * The followings are the available model relations:
 * @property BilletIncident[] $billetIncidents
 */
class Emetteur extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return Emetteur the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'emetteur';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('NOM_EMETTEUR, PRENOM_EMETTEUR, MAIL_EMETTEUR, LOGIN_EMETTEUR, PASSWORD_EMETTEUR', 'required'),
			array('NOM_EMETTEUR, PRENOM_EMETTEUR, LOGIN_EMETTEUR, PASSWORD_EMETTEUR', 'length', 'max'=>50),
			array('MAIL_EMETTEUR', 'length', 'max'=>60),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('ID_EMETTEUR, NOM_EMETTEUR, PRENOM_EMETTEUR, MAIL_EMETTEUR, LOGIN_EMETTEUR, PASSWORD_EMETTEUR', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'billetIncidents' => array(self::HAS_MANY, 'BilletIncident', 'ID_EMETTEUR'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'ID_EMETTEUR' => 'Id Emetteur',
			'NOM_EMETTEUR' => 'Nom Emetteur',
			'PRENOM_EMETTEUR' => 'Prenom Emetteur',
			'MAIL_EMETTEUR' => 'Mail Emetteur',
			'LOGIN_EMETTEUR' => 'Login Emetteur',
			'PASSWORD_EMETTEUR' => 'Password Emetteur',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('ID_EMETTEUR',$this->ID_EMETTEUR);
		$criteria->compare('NOM_EMETTEUR',$this->NOM_EMETTEUR,true);
		$criteria->compare('PRENOM_EMETTEUR',$this->PRENOM_EMETTEUR,true);
		$criteria->compare('MAIL_EMETTEUR',$this->MAIL_EMETTEUR,true);
		$criteria->compare('LOGIN_EMETTEUR',$this->LOGIN_EMETTEUR,true);
		$criteria->compare('PASSWORD_EMETTEUR',$this->PASSWORD_EMETTEUR,true);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}